﻿using System;
using Prism.Events;
using System.Threading;
using FrameWork.Core.Enum;
using FrameWork.Core.China;
using System.Collections.Generic;

namespace FrameWork.Core.Chain.Entitys
{
    public abstract class ProcessBase
    {
        /// <summary>
        /// 唯一主键
        /// </summary>
        public virtual string Guid { get; set; } = System.Guid.NewGuid().ToString("N");
        /// <summary>
        /// 退出程序
        /// </summary>
        public bool Exit { get; set; } = false;
        /// <summary>
        /// 工作流名称
        /// </summary>
        public string FlowName { get; set; }
        /// <summary>
        /// 工作流编号
        /// </summary>
        public int FlowType { get; set; }
        ///// <summary>
        ///// 运行状态
        ///// </summary>
        public EnumProcessState State { get; set; }
        /// <summary>
        /// 流程中断信号
        /// </summary>
        public CancellationTokenSource Cts { get; set; }
        /// <summary>
        /// 流程同步信号量
        /// </summary>
        public AutoResetEvent AutoReset { get; set; }
        /// <summary>
        /// 节点数量
        /// </summary>
        public int TotalNode { get; set; }
        /// <summary>
        /// 数据回调标记
        /// </summary>
        public SubscriptionToken JumpToken { get; set; }
        /// <summary>
        /// 检查点过滤器
        /// </summary>
        public abstract Func<ProcessBase, IEnumerable<IProcessNode>> ProcessNodeFilter { get; set; }
    }
}